<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例5准备</title>
</head>
<body>
    <script>
        //邮箱只允许由英文字母，数字和下划线组成，必须包含"@"和"."
        const email = "hello@q@q.com";
        const regemail = /^\w+@\w+(\.[a-zA-Z]{2,3}){1,2}$/
        console.log("email",regemail.test(email));

        //用户名由4~16位字母，数字和下划线组成
        const user = "jack";
        const reguser = /^\w{4,16}$/;
        console.log("user",reguser.test(user));

        //密码由字母，数字和下划线组成，最少8个字符
        const password = "12341234";
        const regpassword = /^\w{8,}$/
        console.log("password",regpassword.test(password))

        //手机号长度为11位，只能以13，14，15，18开头
        const mobile = "12112341234";
        const regmobile = /^(13|14|15|18)\d{9}$/
        console.log("mobile",regmobile.test(mobile))
    </script>
</body>
</html>